package org.jiuling.aliyun.sms.returnreceipt;

import org.jiuling.aliyun.sms.exception.AliYunSMSRuntimeException;
import org.jiuling.aliyun.sms.returnreceipt.model.SmsReportReturnReceiptModel;
import org.jiuling.basics.converter.MapConvert;
import org.jiuling.basics.exception.BasicsException;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author 紫灵
 * @date 2023年02月14日 15时43分06秒
 */
public class HttpReturnReceipt{

    /** 私有构造方法，禁止创建对象 */
    private HttpReturnReceipt() {}

    /**
     * 短信请求回执
     * @param paramMapList 参数集合列表
     * @return 短信请求模型模型
     */
    public static List<SmsReportReturnReceiptModel> smsReportReturnReceipt(List<Map<String,Object>> paramMapList){
        return paramMapList.parallelStream().map(paramMap -> {
            try {
                return MapConvert.toObject(paramMap, SmsReportReturnReceiptModel.class);
            }catch (BasicsException e) {
                throw new AliYunSMSRuntimeException(e.getLocalizedMessage());
            }
        }).collect(Collectors.toList());
    }
}
